{*
SPDX-FileCopyrightText: © 2021 Olivier Meunier <olivier@neokraft.net>

SPDX-License-Identifier: AGPL-3.0-only
*}
{{ extends "./base" }}
{{ import "/_libs/forms" }}

{{ block title() }}Password{{ end }}

{{ block mainContent() }}
<h1 class="title text-h2">Change your password</h1>

<form action="{{ urlFor() }}" method="post">
  {{ yield formErrors(form=.Form) }}
  {{ yield csrfField() }}

  {{ yield passwordField(
    field=.Form.Get("current"),
    required=true,
    label="Current password",
    class="field-h",
    inputAttrs=attrList("autocomplete", "current-password"),
  ) }}

  {{ yield passwordField(
    field=.Form.Get("password"),
    required=true,
    label="New password",
    class="field-h",
    inputAttrs=attrList("autocomplete", "new-password"),
    help="must be at least 8 characters long",
  ) }}

  <p><button class="btn-primary" type="submit">Save</button></p>
</form>

{{ end }}
